package com.ym.excel.jfree;

/**
 * @Author: smuswc
 * @Date: 2018/2/7 14:42
 * @Description:
 */
public class YMChartFactory {

    private YMChartFactory() {}
    private static YMJFreeLineChart jFreeLineChart = new YMJFreeLineChart();
    private static YMJFreeBarChart jFreeBarChart = new YMJFreeBarChart();
    private static YMJFreePieChart jFreePieChart = new YMJFreePieChart();

    /**
     * 根据指定类型获取相应的绘图工具
     * @param type
     * @return
     */
    public static YMChart createChart(YMChartType type) {
        switch (type) {
            case PIE:
                return jFreePieChart;
            case BAR:
                return jFreeBarChart;
            case LINE:
                return jFreeLineChart;
            default:
                return null;
        }
    }

    /**
     * 绘图工具类型
     */
    public enum YMChartType {
        PIE, // 饼图
        LINE, // 折线图
        BAR // 柱形图
    }
}
